import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

import postcssPxtorem from 'postcss-pxtorem';

// https://vite.dev/config/
export default defineConfig({
  // 禁用 eslint-plugin-vue 错误提示
  lintOnSave: false,
  plugins: [
    vue(),
  ],
  css: {
    preprocessorOptions: {
      css: {
        plugins: [
          postcssPxtorem({
            rootValue: 16,
            propList: ['*'],
            selectorBlackList: ['van-'] // 你可以在这里添加你想要排除的类名
          })
        ]
      },
      scss: {
        additionalData: `@use "@/styles/_variables" as *;`
      }
    }
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  server: {
    port: 9013,
    proxy: {
      '/api': {
        target: 'http://localhost:9011',
        changeOrigin: true
      }
    }
  }
})
